<template>
  <Modal v-model="ModalFlag" :title="title">
    <Form ref="formData" :model="formData" :rules="formRules" :label-width="60">
      <FormItem prop="reason" label="原因">
        <Input type="text" v-model="formData.reason" placeholder="请输入"></Input>
      </FormItem>
    </Form>
    <div slot="footer">
      <Button @click="cancel">取消</Button>
      <Button type="primary" @click="Ok">确认</Button>
    </div>
  </Modal>
</template>

<script>
export default {
  name: 'index',
  data () {
    return {
      formData: {
        reason: ''
      },
      formRules: {
        reason: [{ required: true, message: '请输入原因', trigger: 'blur' }]
      },
      titleName: ''
    }
  },
  props: {
    title: {
      type: String,
      default: '你确定要执行操作吗，请填写原因',
    },
    ModalOk: {
      type: Function
    },
    ModalCancel: {
      type: Function
    },
    ModalFlag: {
      type: Boolean,
      default: false,
    }
  },
  mounted () {
  },
  methods: {
    Ok () {
      this.$emit('ModalOk', this.formData.reason)
    },
    cancel () {
      this.$emit('ModalCancel', this.formData.reason)
    }
  }
}
</script>

<style scoped>

</style>
